<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			window.onload=function(){
				var Obox=document.getElementsByClassName("box");
				
				document.onmousedown=function(evt){
					var e=evt||event;
					var dix=e.clientX;
					var diy=e.clientY;
					document.onmousemove=function(evt){
						var e=evt||event;
						var x=e.clientX-dix;
						var y=e.clientY-diy;
						$(".box").css({"transform":"rotateX("+x+"deg) rotateY("+y+"deg)"});
					}
					document.onmouseup=function(){
						document.onmousemove=null;
					}					
				}

			}
		</script>
		<style type="text/css">
			.box{
				position: relative;
				width: 200px;
				height: 200px;
				margin: 150px auto;
				transform-style: preserve-3d;
				transform: rotateY(30deg) rotateX(-30deg);
			}
			.back, .left, .right, .top, .front, .bottom{
				position: absolute;
				width: 200px;
				height: 200px;
				left: 0px;
				top: 0px;
				opacity: 0.3;
				text-align: center;
				line-height: 200px;
				font-size: 60px;
				font-weight: bold;
				
			}
			.back{
				background: blue;
				transform:  translateZ(-100px);
			}
			.left{
				background: green;
				transform:rotateY(90deg) translateZ(-100px); 
			}
			.right{
				background: red;
				transform: rotateY(90deg) translateZ(100px);
			}
			.bottom{
				background: gray;
				transform: rotateX(90deg) translateZ(100px);
			}
			.top{
				background: yellow;
				transform: rotateX(90deg) translateZ(-100px);
			}
			.front{
				background: black;
				transform: translateZ(100px);
			}
		</style>
	</head>
	<body>
		<div class="box">
			<div class="back">
				背后
			</div>
			<div class="left">
				左边
			</div>
			<div class="right">
				右边
			</div>
			<div class="top">
				上面
			</div>
			<div class="front">
				前面
			</div>
			<div class="bottom">
				底面
			</div>
		</div>
	</body>
</html>
